<?php if(!empty($subvo)){
    $v = $subvo;
    $subvo = '';
}
if(!empty($subsubvo)){
    $v = $subsubvo; 
    $subsubvo = '';
}
?>
<div class="viewBox myBox<?php echo $v['id'];?>" <?php if($_SESSION[C('USER_AUTH_KEY')]){?> sortID="<?php echo $v['sort'];?>" modulesID="<?php echo $v['id'];?>" title="<?php echo $v['title'];?>" deleteUrl="<?php echo U('/Admin/Modules/delete',array('id'=>$v['id']));?>" settingUrl="<?php echo U('/Admin/Modules/edit',array('id'=>$v['id']));?>" isEdit="0"<?php }?>>
  <?php if(!empty($v['dataname'])){ 
                $v['content'] = $v['dataname'];
                
        }else{
            $v['content'] = unserialize($v['content']);
        }
         ?>
  <div class="panel panel-primary">
    <?php include(TMPL_PATH.'Home/TemplateDefault/Public-Moduletitle'.C('TMPL_TEMPLATE_SUFFIX')); ?>
    <div class="panel-body">
    <div style="height:48px;"></div>
    <ul class="nav-glyphicons-list navbar-fixed-top" style="background-color:#f5f5f5; border-bottom:1px solid #ccc;">
                  <li style="text-align:center;" class="first"> <a href="javascript:void(0);" onClick="setSort<?php echo $v['id'];?>();" target="_blank"><span class="fa fa-list" aria-hidden="true"></span> </a></li>
                        <li style="text-align:center;" class="last"> <a href="__APP__/" target="_blank"><span class="fa fa-home" aria-hidden="true"></span></a></li>
                </ul>
    <form class="bs-example bs-example-form" data-example-id="input-group-with-button" style="padding-top:2px; margin:0 45px; position:fixed; z-index:2000; top:3px;">
    <div class="row">
      <div class="col-lg-12"> 
        <div class="input-group">
          <input type="text" class="form-control" name="keywords" value="{$keywords}" placeholder="输入关键词">
          <span class="input-group-btn">
            <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
          </span>
        </div>
      </div>
    </div>
  </form>
    
    
    
    
    <div class="row SortControl" id="SortControl<?php echo $v['id'];?>" style="position:fixed; top:0; background:#fff; left:0; width:100%; z-index:100;"> 
      <div class="col-xs-3 col">
       <a href="javascript:void(0);" class="btn btn-default btn-sm" onClick="Dosort('<?php echo $sorttype;?>','price');">价格
       <?php if($sortfield == 'price'){?>
           <?php if($sorttype == 'asc'){?>
           <i class="glyphicon glyphicon-arrow-up"></i>
           
           <?php }else{?>
           <i class="glyphicon glyphicon-arrow-down"></i>
           <?php }?>
       <?php }?></a>
      </div>
       <div class="col-xs-3 col">
       <a href="javascript:void(0);" class="btn btn-default btn-sm" onClick="Dosort('<?php echo $sorttype;?>','salecount');">销量
       <?php if($sortfield == 'salecount'){?>
           <?php if($sorttype == 'asc'){?>
           <i class="glyphicon glyphicon-arrow-up"></i>
           
           <?php }else{?>
           <i class="glyphicon glyphicon-arrow-down"></i>
           <?php }?>
       <?php }?></a>
       
      </div>
      <div class="col-xs-3 col">
      <a href="javascript:void(0);" class="btn btn-default btn-sm" onClick="$('#SortControl<?php echo $v['id'];?>').animate({top:'0'});" data-toggle="modal" data-target="#myModal<?php echo $v['id'];?>">筛选</a>
      </div>
       <div class="col-xs-3 col">
       
       <a href="javascript:void(0);" onClick="$('#SortControl<?php echo $v['id'];?>').animate({top:'0'});" class="btn btn-default btn-sm" data-toggle="modal" data-target="#cmyModal<?php echo $v['id'];?>">分类</a>
      </div>
    </div>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      <?php foreach($v['content'] as $key => $p):?>
      <div class="col-md-3 col-xs-6 col-sm-4 list<?php echo $key+1;?>">
        <div class="thumbnail"><a <?php if(getArtLink($p['id'], $p['module']) == ''){?>rel="lightbox-demo"<?php }?> href="<?php if(getArtLink($p['id'], $p['module']) == ''){?><?php echo getThumbPath($p['img_url']);?><?php }else{ ?><?php echo getArtLink($p['id'], $p['module']);?><?php }?>"><img alt="<?php echo $p['title'];?>" src="<?php echo getThumbPath($p['img_url'],$v['thumbtype']);?>" width="100%" /></a>
          <div class="caption" style="position:relative">
            <h3> <a href="<?php echo getArtLink($p['id'], $p['module']);?>"><?php echo cut_str($p['title'],$v['listTitleLength'],0);?></a> </h3>
            
            
            
            
            
            <?php if($p['RebateModel'] == 1){?>
            
<p><span style="display:none;" class="RebateModel">8%系列</span></p>
            <?php }?>
            <?php if($p['RebateModel'] == 2){?>
            
<p><span  style="display:none;" class="RebateModel">16%系列</span></p>
            <?php }?>
            
            <?php if($p['RebateModel'] == 3){?>
            
<p><span  style="display:none;" class="RebateModel">2%系列</span></p>
            <?php }?>
            
             
            
            <?php if($p['RebateModel'] == 4){?>
            
<p><span  style="display:none;" class="RebateModel">4%系列</span></p>
            <?php }?>
            
            
            
            <p class="priceLine"><span class="price">¥<?php echo $p['price'];?></span><span product_id="<?php echo $p['id'];?>" class="product_id<?php echo $v['id'];?>"></span><span class="originalCost" style="display:none;">原价：¥<?php echo $p['originalCost'];?></span></p>
            
            
            
            
            
            
            
            <?php if($v['listContentLength'] > 0){?>
            <p> <?php echo cut_content($p,$v['listContentLength'], 0, $v['listContentOut']); ?> </p>
            <?php }?>
            <span class="datetime"><?php echo date('Y-m-d', $p['datetime']);?></span> 
            
            
            
            
            
            
            
            
            
            
             <a style="position:absolute; right:5px; bottom:2px; color:#CC3636; font-size:1.5em;" class="addCartList" onClick="addCartList(<?php echo $p['id'];?>);"><i class="fa fa-cart-plus"></i></a>
            
            
            
            
            
            
            </div>
        </div>
      </div>
      <?php endforeach; ?>
      <div class="clearfix" style="clear:both;"></div>
      
      
      <?php echo $pages; ?>
      
      
      
      
      
      
      
      
      
      
      <script>
	  function setSort<?php echo $v['id'];?>(){
		  if($('#SortControl<?php echo $v['id'];?>').css('top') == '0px'){
		  $('#SortControl<?php echo $v['id'];?>').animate({top:'45px'},50); 
		  }else{ $('#SortControl<?php echo $v['id'];?>').animate({top:'0'},50);}
		 }
		 
		 function Dosort(sorttype, sortfield){
		if(sorttype == 'asc'){
			sorttype = 'desc';
		}else{
			sorttype = 'asc';
		}
		$('#sorttype').val(sorttype);
		
		$('#sortfield').val(sortfield);
		attrSubmit('');
	}
	function attrSubmit(id){
		var isAdd=true;
		$("#attrForm input[type='hidden']").each(function(index, element) {
            if($(this).val()==id){
				$(this).remove();
				isAdd=false;
			}
			if($(this).val().split('_')[0]==id.split('_')[0]){
				$(this).remove();
			}
        });
		if(isAdd){
			$('<input type="hidden" name="attrval[]" value="'+id+'">').appendTo("#attrForm");
		}
		//生成条件
		var map=new Array();
		$("#attrForm input[type='hidden']").each(function(index, element) {
            map.push($(this).val());
        });
		$("#attrFormRe input[name='attrvalRe']").val(map.join(';'));
		if($("#attrFormRe input[name='attrvalRe']").val()==''){
			$("#attrFormRe input[name='attrvalRe']").val('notattr');
		}
		
		// alert($("#attrFormRe input[name='attrvalRe']").val());
		document.getElementById("attrFormRe").submit(); return;
		//$("#attrFormRe").submit();
	}
	  </script>
      
      
      
      
      
    <div class="modal fade" style="z-index:2001;" id="myModal<?php echo $v['id'];?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">商品筛选</h4>
          </div>
          <div class="modal-body">
            
            <form action="<?php U('Product/index');?>" id="attrFormRe" method="get">
<input type="hidden" name="id" value="<?php echo $cid;?>">
<input type="hidden" name="p" value="0">
<input type="hidden" name="keywords" value="{$keywords}">
<input type="hidden" id="sorttype" name="sorttype" value="{$sorttype}">
<input type="hidden" id="sortfield" name="sortfield" value="{$sortfield}">


<input type="hidden" name="attrvalRe" value="">
</form>
            <?php if($attrList){?>





<div id="attrForm">

<?php foreach($curattrval as $key => $voattr){?>
	<input type="hidden" name="attrval[]" value="<?php echo $voattr;?>">
<?php }?>
</div>





<?php foreach($attrList as $key => $voattr){?>





<div class="row sedAttr">
    <div class="col-xs-2"><?php echo $voattr['title'];?></div>
    <div class="col-xs-10"><?php foreach($voattr['list'] as $key => $lvoattr){?>
        	<a <?php if(in_array($voattr['id'].'_'.$lvoattr['id'],$curattrval)){?>class="cur"<?php }?> href="#" onClick="attrSubmit('<?php echo $voattr['id'];?>_<?php echo $lvoattr['id'];?>');"><?php echo $lvoattr['val'];?></a>
            <?php }?></div>
</div>






<?php }?>






<?php } ?>
    
            
            
            
          </div>
          <div class="modal-footer">
            
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          </div>
        </div>
      </div>
    </div>
      
      
      
      
      
      
      
      
      
      
      
      
    </div>
  </div>
  
  
  
  <!-- 分类 -->
  
  <div class="modal fade" style="z-index:2001;" id="cmyModal<?php echo $v['id'];?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">商品分类</h4>
          </div>
          <div class="modal-body">
           
           
           
          
           <?php foreach($subcate as $key => $vo){?>
           <a href="__APP__/<?php echo $vo['name'];?>" style="display:inline-block; padding:5px 8px;"><?php echo $vo['title'];?></a>
          
           
           <?php }?>
           
           
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            
          </div>
        </div>
      </div>
    </div>
  <!-- -->
</div>
